package com.quectel.cms.vo.scheduling;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 在这里编写说明
 *
 * @author: bob
 * @email: bob.yu@quectel.com
 * @date: 2023-08-03 16:52:00
 */
@NoArgsConstructor
@Data
public class CheckDateWorkTimeResp {

    @Schema(description = "时间段名称")
    private String name;

    @Schema(description = "开始时间")
    private String start;

    @Schema(description = "结束时间")
    private String end;

    @Schema(description = "时间段组合名")
    private String period;

    @Schema(description = "时间段配置id")
    private Long timeConfigId;

    @Schema(description = "考勤分组信息")
    private List<Groupcls> group;

    @NoArgsConstructor
    @Data
    public static class Groupcls {

        @Schema(description = "考勤组名称")
        private String groupName;

        @Schema(description = "考勤组id")
        private Long groupId;

        @Schema(description = "隶属考勤组人员list")
        private List<Peoplecls> people;

        @NoArgsConstructor
        @Data
        public static class Peoplecls {

            @Schema(description = "人员id")
            private Long personId;

            @Schema(description = "人员名称")
            private String name;
        }
    }

    public void setPeriod(String workTime, String closingTime) {
        this.period = formatPeriod(workTime, closingTime);
    }

    private String formatPeriod(String workTime, String closingTime) {
        return workTime + "~" + closingTime;
    }
}
